<html>
<head><meta charset="utf-8"><title>Questions about StorageDead · t-compiler/wg-mir-opt · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/index.html">t-compiler/wg-mir-opt</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Questions.20about.20StorageDead.html">Questions about StorageDead</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="239910777"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Questions%20about%20StorageDead/near/239910777" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Questions.20about.20StorageDead.html#239910777">(May 23 2021 at 00:21)</a>:</h4>
<ul>
<li>Are <code>StorageDead</code>s needed before a <code>return</code>?  Or does everything (except <code>_0</code>) implicitly die there anyway?</li>
<li>Are <code>StorageDead</code>s for things that are already dead (or were never live) a correctness problem?  Or are they handled fine, just undesirable as any unnecessary instruction would be?</li>
</ul>
<p>(If I should go read a doc somewhere, please point me there -- I didn't see anything about these in <a href="https://rustc-dev-guide.rust-lang.org/mir/index.html">https://rustc-dev-guide.rust-lang.org/mir/index.html</a> )</p>



<a name="239941266"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Questions%20about%20StorageDead/near/239941266" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Questions.20about.20StorageDead.html#239941266">(May 23 2021 at 10:33)</a>:</h4>
<p>Duplicate StorageDead are not a correctness issue</p>



<a name="239941381"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Questions%20about%20StorageDead/near/239941381" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Questions.20about.20StorageDead.html#239941381">(May 23 2021 at 10:35)</a>:</h4>
<p>They may be needed before return for borrowck. But I don't see why. There are also lots of storagedead that are unnecessary because its local is never borrowed. Technically we can remove all such storage markers and just compute the storage liveness on the fly for llvm optimizations</p>



<a name="239978994"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Questions%20about%20StorageDead/near/239978994" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Questions.20about.20StorageDead.html#239978994">(May 23 2021 at 21:22)</a>:</h4>
<p>Thanks, oli!</p>
<p>One more question: is the <em>order</em> of the <code>StorageDead</code>s important?  For example, does anything rely on a reference dying before the local it references?  Or is a run of them functionally all handled together, so it doesn't really matter?</p>



<a name="239984450"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/Questions%20about%20StorageDead/near/239984450" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/Questions.20about.20StorageDead.html#239984450">(May 23 2021 at 23:03)</a>:</h4>
<p>Hmm, good point. I think it may matter to borrowck, but not llvm. Unsure. We could test that by adding an order scrambler mir opt before borrowck</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>